
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.4.5.min.css">
<script src="jquery.min.js"></script>
<script src="jquery.mobile-1.4.5.min.js"></script>
<script>
//写事件
$(document).ready(function(){

			$("#inputdata").click(function(){
					var pwm1=$('#PWM1').val();
					var pwm2=$('#PWM2').val();
					var pwm3=$('#PWM3').val();
					var pwm4=$('#PWM4').val();
					var pwm5=$('#PWM5').val();
					var pwm6=$('#PWM6').val();
					$.get("/PWM_post",{
								Data1:pwm1,
								Data2:pwm2,
								Data3:pwm3,
								Data4:pwm4,
								Data5:pwm5,
								Data6:pwm6
								}, 
					function(result){ alert("数据提交成功！");}
					);
			});
				$("#getdata").click(function(){
									
									$.get("/PWM_get",function(resJson){ 
									$('#PWM1').val(resJson[0]).slider('refresh');
									$('#PWM2').val(resJson[1]).slider('refresh');
									$('#PWM3').val(resJson[2]).slider('refresh');
									$('#PWM4').val(resJson[3]).slider('refresh');
									$('#PWM5').val(resJson[4]).slider('refresh');
									$('#PWM6').val(resJson[5]).slider('refresh');
									alert("获取数据成功！")
									}
									);
							});
			$("#input_net").click(function(){
					var ssid=$('#ssid').val();
					var pwd=$('#pwd').val();
					$.get("/net_get",{
							SSID:ssid,
							PWD:pwd,
					},
					function(result){ alert("网络提交成功！ip为:"+resJson[0]);}				);
					
					});
			
		
});

function currentTime(){
	var d = new Date(),str = '';
 str += d.getFullYear()+'.';
 str  += d.getMonth() + 1+'.';
 str  += d.getDate()+'.';
 str += d.getHours()+'.'; 
 str  += d.getMinutes()+'.'; 
str+= d.getSeconds()+''; 
return str;
}

setInterval(function(){$('#time').html(currentTime)},1000);


</script>

	</head>
<body>
<div data-role="page" id="pageone">
	<div data-role="header">
		<h1>灯光控制</h1>
	</div>
	
	<div data-role="panel" id="myPanel"> 
		<h2>菜单</h2>
		<a href="#Com_set" class="ui-btn ui-corner-all ui-shadow">自动模式设置</a>
		<a href="#Model_set" class="ui-btn ui-corner-all ui-shadow">手动模式设置</a>
		<a href="#Network_set" class="ui-btn ui-corner-all ui-shadow">网络设置</a>
		<a href="#About" class="ui-btn ui-corner-all ui-shadow">关于作者</a>
	</div> 
	  
    <div data-role="main" class="ui-content">
		
		<a href="#myPanel" class="ui-btn ui-btn-inline ui-corner-all ui-shadow">设置</a>
		
		<h1>运行时间:</h1>
		<h1>网络状态：</h1>
		<h1>温度：</h1>
		<h1>状态曲线图：</h1>
	
	</div>
</div>

<div data-role="page" id="Com_set">

	<div data-role="header">
		<h1>自动模式</h1>
	</div>
<div data-role="main">
	
		
	<form method="post" action="demoform.asp"  color="red">
      <label for="PWM1"  >PWM1:</label>
      <input type="range" data-popup-enabled="true" name="red" id="PWM1" value="50" min="0" max="1023">  
      <label for="PWM2">PWM2:</label>
      <input type="range" data-popup-enabled="true" name="bule" id="PWM2" value="50" min="0" max="1023">
      <label for="PWM3">PWM3:</label>
      <input type="range" data-popup-enabled="true"  name="green" id="PWM3" value="50" min="0" max="1023">
      <label for="PWM4">PWM4:</label>
      <input type="range" data-popup-enabled="true" name="red" id="PWM4" value="50" min="0" max="1023">
      <label for="PWM5">PWM5:</label>
      <input type="range" data-popup-enabled="true" name="red" id="PWM5" value="50" min="0" max="1023">
	   <label for="PWM6">PWM6:</label>
      <input type="range" data-popup-enabled="true" name="red" id="PWM6" value="50" min="0" max="1023">
	</form>
<a id="inputdata"  data-role="button">提交</a>
<a id="getdata"  data-role="button">获取</a>
  
	
</div>
</div>
<div data-role="page" id="Model_set">

	<div data-role="header">
		<h1>手动模式</h1>
	</div>
<div data-role="main">
	
		
	<form method="post" action="demoform.asp"  color="red">
      <label for="PWM1"  >PWM1:</label>
      <input type="range" name="red" id="PWM1" value="50" min="0" max="1023">  
      <label for="PWM2">PWM2:</label>
      <input type="range" name="bule" id="PWM2" value="50" min="0" max="1023">
      <label for="PWM3">PWM3:</label>
      <input type="range" name="green" id="PWM3" value="50" min="0" max="1023">
      <label for="PWM4">PWM4:</label>
      <input type="range" name="red" id="PWM4" value="50" min="0" max="1023">
      <label for="PWM5">PWM5:</label>
      <input type="range" name="red" id="PWM5" value="50" min="0" max="1023">
	   <label for="PWM6">PWM6:</label>
      <input type="range" name="red" id="PWM6" value="50" min="0" max="1023">
	</form>
<a id="inputdata"  data-role="button">提交</a>
<a id="getdata"  data-role="button">获取</a>
  
	
</div>
</div>
<div data-role="page" id="Network_set">

			<div data-role="header">
				<h1>手动模式</h1>
			</div>
		<div data-role="main">
			
				
			<form method="post" action="demoform.html">
				<div class="ui-field-contain">
						<h2>家庭网络设置</h2>
						<label for="ssid">SSID</label>
						<input type="text" name="ssid" id="ssid">
						<label for="pwd">Password:</label>
						<input type="text" name="pwd" id="pwd">
				</div>
				<div data-role="controlgroup" data-type="horizontal">
					<a id="input_net"  data-role="button">连接网络</a>
					<a id="input_reset"  data-role="button">重置网络</a>
				</div>
			 </form>

		
		</div>
</div>
	



</body>
</html>
